﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(CalculateTansInChilds))]
public class CalculateTansInChildsEditor : E_ShowButtons<CalculateTansInChilds> { }
#endif
public class CalculateTansInChilds : MonoBehaviour
{
    public SkinnedMeshRenderer[] smrs;
    [ShowButton]
    void Calculate()
    {
        smrs = GetComponentsInChildren<SkinnedMeshRenderer>(true);
        foreach (var smr in smrs)
        {
            smr.sharedMesh.RecalculateTangents();
        }
    }
    [ShowButton]
    void UseBinormalAsTangent()
    {
        smrs = GetComponentsInChildren<SkinnedMeshRenderer>(true);
        foreach (var smr in smrs)
        {
            smr.UseBinormalAsTangent();
        }
    }
}
